#include"../logs/log.h"
#include <unistd.h>
void test_log(const std::string&name)
{
    INFO("%s","测试开始");
    log::Logger::ptr logger = log::LoggerManager::getInstance().getLogger(name);
    logger->debug("%s","测试日志");
    logger->info("%s", "测试日志");
    logger->warn("%s", "测试日志");
    logger->error("%s", "测试日志");
    logger->fatal("%s", "测试日志");
    INFO("%s", "测试完毕");
}
int main()
{
    std::unique_ptr<log::LoggerBuilder> builder(new log::GlobalLoggerBuilder());
    builder->buildLoggerName("async_logger");
    builder->buildLoggerLevel(log::LogLevel::value::DEBUG);
    builder->bulidFormatter("[%c][%f:%l][%p]%m%n");
    builder->buildLoggerType(log::LoggerType::LOGGER_SYNC);
    builder->buildSink<log::FileSink>("./logfile/sync.log");
    builder->buildSink<log::StdoutSink>();
    builder->buildSink<log::RollBySizeSink>("./logfile/roll-sync-by-size",1024*1024);
    builder->build();
    test_log("async_logger");
    return 0;
}